<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="style/editor.css" rel="stylesheet" type="text/css" />

	<script type="text/javascript">
	var sLangDir=dialogArguments.oUtil.langDir;
	document.write("<scr"+"ipt src='language/"+sLangDir+"/flash.js'></scr"+"ipt>");
	</script>

	<script language="JavaScript" type="text/javascript" src="color_picker.js"></script>

	<script type="text/javascript">writeTitle()</script>

	<script type="text/javascript">
document.onclick=hideAll;
function hideAll()
	{
	oColor1.hide();
	}

function GetElement(oElement,sMatchTag)
	{
	while (oElement!=null&&oElement.tagName!=sMatchTag)
		{
		if(oElement.tagName=="BODY")return null;
		oElement=oElement.parentElement;
		}
	return oElement;
	}

function doWindowFocus()
	{
	dialogArguments.oUtil.onSelectionChanged=new Function("realTime()");
	}
function bodyOnLoad()
	{
	window.onfocus=doWindowFocus;	
	dialogArguments.oUtil.onSelectionChanged=new Function("realTime()");

	//if(dialogArguments.oUtil.obj.cmdAssetManager!="")btnAsset.style.display="block";

	realTime()
	}
function openAsset()
	{
	inpSwfURL.value=eval(dialogArguments.oUtil.obj.cmdAssetManager);	
	}
function modalDialogShow(url,width,height)
	{
	if(url.indexOf("?")==-1) url=url+"?ffilter=flash";//no querystring
	else url=url+"&ffilter=flash";
	
	return window.showModalDialog(url,window,
		"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:Yes;help:No;Resizable:Yes;Maximize:Yes");
	}
function realTime()
	{
	if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
	var oEditor=dialogArguments.oUtil.oEditor;
	var oSel=oEditor.document.selection.createRange();
	var sType=oEditor.document.selection.type;

	clearAllProperties()

	if (oSel.parentElement)	oEl=GetElement(oSel.parentElement(),"OBJECT");
	else oEl=GetElement(oSel.item(0),"OBJECT");

	if (oEl)
		{
		inpSwfURL.value=oEl.movie;
		inpSwfWidth.value=oEl.width;
		inpSwfHeight.value=oEl.height;
		if(oEl.loop)rdoSwfLoop[0].checked=true;
		else rdoSwfLoop[1].checked=true;
		if(oEl.quality==1)inpSwfQuality.value="high";
		else inpSwfQuality.value="low"
		idSelBackColor.style.background=oEl.bgColor;
		//inpSwfAlign.value=oEl.align;//not work
		if(oEl.innerHTML.indexOf("align=\"L\"")!=-1)inpSwfAlign.value="L";
		else if(oEl.innerHTML.indexOf("align=\"R\"")!=-1)inpSwfAlign.value="R";
		else if(oEl.innerHTML.indexOf("align=\"T\"")!=-1)inpSwfAlign.value="T";
		else if(oEl.innerHTML.indexOf("align=\"B\"")!=-1)inpSwfAlign.value="B";
		else inpSwfAlign.value="";
		}
	}
function clearAllProperties()
	{
	inpSwfURL.value="";
	inpSwfWidth.value=100;
	inpSwfHeight.value=100;	
	rdoSwfLoop[0].checked=true;
	inpSwfQuality.value="high";
	idSelBackColor.style.background="";
	inpSwfAlign.value="";
	}

function doApply()
	{
	if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
	var oEditor=dialogArguments.oUtil.oEditor;
	var oSel=oEditor.document.selection.createRange();
	var sType=oEditor.document.selection.type;

	if (oSel.parentElement)	oEl=GetElement(oSel.parentElement(),"OBJECT");
	else oEl=GetElement(oSel.item(0),"OBJECT");
	
	dialogArguments.oUtil.obj.saveForUndo();

	if(rdoSwfLoop[0].checked)
		sSwfLoop="true";
	else
		sSwfLoop="false";

	var sHTML = "<object "+
		"classid=\""+inpSwfClassID.value+"\" " +
		"width=\""+inpSwfWidth.value+"\" "+
		"height=\""+inpSwfHeight.value+"\" " +
		"codebase=\""+inpSwfCodeBase.value+"\">"+
		"	<param name=movie value=\""+inpSwfURL.value+"\">" +
		"	<param name=play value=\"true\">" +
		"	<param name=loop value=\""+sSwfLoop+"\">" +
		"	<param name=WMode value=\"Opaque\">" +
		"	<param name=quality value=\""+inpSwfQuality.value+"\">" +
		"	<param name=bgcolor value=\""+idSelBackColor.style.backgroundColor+"\">" +
		"	<param name=align value=\""+inpSwfAlign.value+"\">\n" +
		"<embed src=\""+inpSwfURL.value+"\" width=\""+inpSwfWidth.value+"\" height=\""+inpSwfHeight.value+"\" play=\"true\" loop=\""+sSwfLoop+"\" wmode=\"Opaque\" quality=\""+inpSwfQuality.value+"\" bgcolor=\""+idSelBackColor.style.backgroundColor+"\" align=\""+inpSwfAlign.value+"\" pluginspage=\""+inpSwfPluginsPage.value+"\"></embed>\n"+
		"</object>";		
	
	if(oEl)oEl.removeNode(oEl);
	var obj=dialogArguments.oUtil.obj;
	obj.insertHTML(sHTML);
	}			
	</script>

</head>
<body onload="loadTxt();bodyOnLoad()" style="overflow: hidden;">
	<table width="100%" height="100%" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td valign="top" style="padding: 5; height: 100%">
				<table cellpadding="2" cellspacing="0">
					<tr>
						<td width="90px" nowrap>
							<span id="txtLang" name="txtLang">Source</span>:&nbsp;&nbsp;</td>
						<td colspan="4" width="100%">
							<table cellpadding="0" cellspacing="0" width="100%" id="Table2">
								<tr>
									<td width="100%">
										<input type="text" name="inpSwfURL" style="width: 100%" value="" class="inpTxt"></td>
									<td>
										<img src="/images/icons/folder.gif" onclick="chooseFile('avatar')" style="cursor: pointer;" />

										<script type="text/javascript">
										function chooseFile(type)
										{
											openpreview('/GUI/EditoralOffice/MainOffce/FileManager/default.aspx?function=avatar_loadValue&mode=single&share=share', 900, 700);
										}
										function avatar_loadValue(arrImage)
										{
											if (arrImage.length > 0) document.getElementById('inpSwfURL').value = arrImage[0];
										}
										function openpreview(sUrl,w,h)
										{
											var winX = 0;
											var winY = 0;
											if (parseInt(navigator.appVersion) >= 4)
											{
												winX = (screen.availWidth - w)*.5;
												winY = (screen.availHeight - h)*.5;
											}
											return window.open(sUrl,'','scrollbars,resizable=yes,status=no, width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
										}
										</script>

									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td nowrap>
							<span id="txtLang" name="txtLang">Background</span>:&nbsp;&nbsp;</td>
						<td nowrap colspan="4">
							<span><span id="idSelBackColor" style="border: gray 1 solid; width: 20; margin-right: 3;">
							</span></span>
							<input type="button" name="btnPick" id="btnPick" value="Pick" onclick="oColor1.show(this);event.cancelBubble=true;"
								class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">

							<script type="text/javascript">	
			var oColor1 = new ColorPicker("oColor1");
			oColor1.onPickColor = new Function("idSelBackColor.style.backgroundColor=oColor1.color;");
			oColor1.onRemoveColor = new Function("idSelBackColor.style.backgroundColor='';");
			oColor1.align="left";
			oColor1.onShow = new Function("tbl1.style.width='23px';tbl2.style.width='23px'");
			oColor1.onHide = new Function("tbl1.style.width='100px';tbl2.style.width='100px'");
			oColor1.txtCustomColors=getTxt("Custom Colors");
			oColor1.txtMoreColors=getTxt("More Colors...");
			oColor1.RENDER();
							</script>

						</td>
					</tr>
					<tr>
						<td nowrap>
							<span id="txtLang" name="txtLang">Width</span>:</td>
						<td colspan="4">
							<input type="text" name="inpSwfWidth" value="100" size="4" class="inpTxt"></td>
					</tr>
					<tr>
						<td nowrap>
							<span id="txtLang" name="txtLang">Height</span>:</td>
						<td colspan="4">
							<input type="text" name="inpSwfHeight" value="100" size="4" class="inpTxt"></td>
					</tr>
					<tr>
						<td nowrap>
							<span id="txtLang" name="txtLang">Quality</span>:&nbsp;&nbsp;</td>
						<td colspan="4">
							<table cellpadding="0" cellspacing="0" id="tbl1" style="table-layout: fixed; width: 100px">
								<tr>
									<td>
										<select name="inpSwfQuality" class="inpSel">
											<option id="optLang" name="optLang" value="low">Low</option>
											<option id="optLang" name="optLang" value="high" selected>High</option>
										</select>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td nowrap width="10%">
							<span id="txtLang" name="txtLang">Align</span>:</td>
						<td colspan="4">
							<table cellpadding="0" cellspacing="0" id="tbl2" style="table-layout: fixed; width: 100px">
								<tr>
									<td>
										<select name="inpSwfAlign" class="inpSel">
											<option id="optLang" name="optLang" value="" selected>&lt;Not Set&gt;</option>
											<option id="optLang" name="optLang" value="L">Left</option>
											<option id="optLang" name="optLang" value="R">Right</option>
											<option id="optLang" name="optLang" value="T">Top</option>
											<option id="optLang" name="optLang" value="B">Bottom</option>
										</select>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td nowrap>
							<span id="txtLang" name="txtLang">Loop</span>:&nbsp;&nbsp;</td>
						<td nowrap colspan="4">
							<input type="radio" value="Radio1" name="rdoSwfLoop" class="inpRdo" checked>
							<span id="txtLang" name="txtLang">Yes</span>&nbsp;
							<input type="radio" value="Radio1" name="rdoSwfLoop" class="inpRdo">
							<span id="txtLang" name="txtLang">No</span>
						</td>
					</tr>
				</table>
				<!-- hidden -->
				<table style="display: none" id="tblAdvance" cellpadding="2" cellspacing="0">
					<tr>
						<td nowrap>
							<span id="txtLang" name="txtLang">Class ID</span>:</td>
						<td>
							<input type="text" name="inpSwfClassID" size="50" value="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
								class="inpTxt"></td>
					</tr>
					<tr style="display: none">
						<td nowrap>
							<span id="txtLang" name="txtLang">CodeBase</span>:</td>
						<td>
							<input type="text" name="inpSwfCodeBase" size="50" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
								class="inpTxt"></td>
					</tr>
					<tr style="display: none">
						<td nowrap>
							<span id="txtLang" name="txtLang">PluginsPage</span>:</td>
						<td>
							<input type="text" name="inpSwfPluginsPage" size="50" value="http://www.macromedia.com/go/getflashplayer"
								class="inpTxt"></td>
					</tr>
				</table>
				<!-- /hidden -->
			</td>
		</tr>
		<tr>
			<td class="dialogFooter" style="padding: 13; padding-top: 7; padding-bottom: 7;"
				align="right">
				<input type="button" name="btnCancel" id="btnCancel" value="cancel" onclick="self.close()"
					class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
				<input type="button" name="btnOk" id="btnOk" value=" ok " onclick="doApply();self.close()"
					class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
			</td>
		</tr>
		<!--
<tr>
<td class="dialogFooter" style="padding:6;" align="right">
	<table cellpadding=1 cellspacing=0>
	<tr>
	<td>
	<input type="button" name=btnCancel id=btnCancel value="cancel" onclick="self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
	</td>
	<td>
	<input type="button" name=btnInsert id=btnInsert value="insert" onclick="doApply();self.close()" style="display:block" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
	</td>
	<td>	
	<input type="button" name=btnOk id=btnOk value=" ok " onclick="doApply();self.close()" style="display:none;" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">	
	</td>
	</tr>
	</table>
</td>
</tr>-->
	</table>
</body>
</html>
